/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.yuecai.modules.yc_order_goods.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author DM
* @date 2020-06-26
**/
@Entity
@Data
@Table(name="yc_order_goods")
public class YcOrderGoods implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @Column(name = "order_sn",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "订单编号")
    private String orderSn;

    @Column(name = "goods_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "商品ID")
    private Long goodsId;

    @Column(name = "goods_name")
    @ApiModelProperty(value = "名称")
    private String goodsName;

    @Column(name = "img",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "主图")
    private String img;

    @Column(name = "count")
    @ApiModelProperty(value = "数量")
    private Integer count;

    @Column(name = "original_price",nullable = false)
    @NotNull
    @ApiModelProperty(value = "原价")
    private BigDecimal originalPrice;


    @Column(name = "vip_discount")
    @ApiModelProperty(value = "vip折扣 例：八折填80")
    private BigDecimal vipDiscount;

    @Column(name = "activity_id")
    @ApiModelProperty(value = "活动id")
    private Long activityId;

    @Column(name = "activity_details")
    @ApiModelProperty(value = "活动详情")
    private String activityDetails;

    @Column(name = "activity_name")
    @ApiModelProperty(value = "活动名称")
    private String activityName;

    @Column(name = "create_time",nullable = false)
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;


    @Column(name = "sell_price",nullable = false)
    @NotNull
    @ApiModelProperty(value = "销售价")
    private BigDecimal sellPrice;


    @Column(name = "unit")
    @ApiModelProperty(value = "单位")
    private String unit;

    @Column(name = "unit_price")
    @ApiModelProperty(value = "单价")
    private BigDecimal unitPrice;

    @Column(name = "sku_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "skuId")
    private Long skuId;


    @Column(name = "spec_values",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "规格")
    private String specValues;


    @Column(name = "gain_type",nullable = false)
    @ApiModelProperty(value = "获取方式")
    private Integer gainType;



    public void copy(YcOrderGoods source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}